﻿using Domain.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EFCore.Configers
{
    public class CMConfigers : IEntityTypeConfiguration<CM>
    {
        public void Configure(EntityTypeBuilder<CM> builder)
        {
            builder.ToTable(nameof(CM));
            builder.Property(x => x.MajorKindId).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.MajorKindName).IsRequired(false).HasMaxLength(60);
            builder.Property(x => x.MajorId).IsRequired(false).HasMaxLength(2);
            builder.Property(x => x.MajorName).IsRequired(false).HasMaxLength(60);
            builder.Property(x => x.TestAmount).IsRequired();
            builder.HasData(new CM()
            {
                MakId = 1,
                MajorKindId = "01",
                MajorKindName = "销售",
                MajorId="01",
                MajorName= "区域经理",
                TestAmount=0
            }, new CM()
            {
                MakId = 2,
                MajorKindId = "01",
                MajorKindName = "销售",
                MajorId = "02",
                MajorName = "总经理",
                TestAmount = 0
            }, new CM()
            {
                MakId = 3,
                MajorKindId = "02",
                MajorKindName = "软件开发",
                MajorId = "01",
                MajorName = "区域经理",
                TestAmount = 0
            }, new CM()
            {
                MakId = 4,
                MajorKindId = "02",
                MajorKindName = "软件开发",
                MajorId = "02",
                MajorName = "程序员",
                TestAmount = 0
            }, new CM()
            {
                MakId = 5,
                MajorKindId = "03",
                MajorKindName = "人力资源",
                MajorId = "01",
                MajorName = "人事经理",
                TestAmount = 0
            }, new CM()
            {
                MakId = 6,
                MajorKindId = "03",
                MajorKindName = "人力资源",
                MajorId = "02",
                MajorName = "专员",
                TestAmount = 0
            }, new CM()
            {
                MakId = 7,
                MajorKindId = "04",
                MajorKindName = "生产部",
                MajorId = "01",
                MajorName = "主任",
                TestAmount = 0
            }, new CM()
            {
                MakId = 8,
                MajorKindId = "04",
                MajorKindName = "生产部",
                MajorId = "02",
                MajorName = "技术工人",
                TestAmount = 0
            }
            );
        }
    }
}
